<%@ page import="domain.Product" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.LinkedHashMap" %>
<%@ page import="java.util.Collection" %><%--
  Created by IntelliJ IDEA.
  User: maoma
  Date: 2024/3/31
  Time: 16:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>购物车</title>
</head>
<body>
<%
    Map<String, Product> product=new LinkedHashMap<String,Product>();
    product.put("1",new Product("1","网管员必备宝典",20,30,"../image/image1.png"));
    product.put("2",new Product("2","学会宽容",20,30,"../image/image1.png"));

%>
 <h1>商品目录</h1>
      <%     Collection<Product> allProducts= product.values();
             session.setAttribute("products",allProducts);
      %>
            <table border="1" align="center">
                <tr>
                   <% for(Product pro:allProducts)
                   {
                   %>
                        <td>
                            <div>
                                <p>
                                    <img src="<%=pro.getImgurl()%>" width="115" height="129" border="0" />
                                </p>
                            </div>
                            <div>
                                <form action="handle-AddCart.jsp?pId=<%=pro.getId()%>"	method="post">
                                    书名：<br><input type="text"	style="border:none;"		name="PName" value=<%=pro.getName()%>></input><br />
                                    售价：<br><input type="text"	style="border:none;"		name="Price" value=￥<%=pro.getPrice()%>> <br />
                                    库存：<br><input type="text"		style="border:none;"	name="PNum" value=<%=pro.getPnum()%>><br />
                                    <input type="submit"  name="book"	value="购买"	>
                                </form>
                            </div>
                        </td>
                    <%}%>
                </tr>
            </table>
</body>
</html>
